<!--conf
<sample>
               <product version="3.0" edition="std"/>
                       <modifications>
                               <modified date="110701"/>
                       </modifications>
               </sample>
 -->
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
	<title>Form linked to grid linked to store</title>
</head>

<body>
	<div id="gridbox" style="width:600px; height:270px; background-color:white;"></div>
	<div id="gridbox2" style="width:600px; height:270px; background-color:white;"></div>
	
<script>
	var data = new dhtmlXDataStore({
		url:"../common/data/data.json",
		ready:function(){
			data.setCursor(data.first());
		},
		datatype:"json",
		ready:function(){
			this.setCursor(this.first);
		}
	});


    mygrid = new dhtmlXGridObject('gridbox');
	mygrid.setImagePath("../../../codebase/imgs/");
	mygrid.setSkin("dhx_skyblue")
	mygrid.setHeader("Package,Maintainer");
	mygrid.setColumnIds("Package,Maintainer")
	mygrid.init();
	mygrid.sync(data, {
		select:true
	});
	
	var formData = [
		{type: "label", label: "Selected record"},
		{type: "input", name: "Package", 	value: "", 	labelWidth:100, label:"Package"},
		{type: "input", name: "Maintainer", value: "", 	labelWidth:100, label: "Maintainer"}
	];

	myform = new dhtmlXForm("gridbox2", formData);
	myform.bind(data);

</script>

<input type='button' value='add' onclick='data.setCursor(data.add({ Package:"New", Maintainer:""}))'>
<input type='button' value='save' onclick='myform.save()'>


</body>
</html>
